import request from "@/utils/request.ts";
import {DeleteRes, QueryParams, QueryRes, SaveParams, SaveRes, QueryListRes} from "@/api/station/type.ts";

/**
 * 删除车站
 * @param {string} id
 * @returns
 */
export function deleteById(id: number): Promise<DeleteRes> {
    return request.delete(`/business/admin/station/delete/${id}`);
}

/**
 * 查询车站列表
 * @param {object} params StationQueryReq
 * @param {number} params.pageNum
 * @param {number} params.pageSize
 * @returns
 */
export function query(params: QueryParams): Promise<QueryRes> {
    return request.post(`/business/admin/station/quest-list`, params);
}

/**
 * 新增车站
 * @param {object} params StationSaveReq
 * @param {number} params.id
 * @param {string} params.name
 * @param {string} params.namePinyin
 * @param {string} params.namePy
 * @param {object} params.createTime
 * @param {object} params.updateTime
 * @returns
 */
export function save(params: SaveParams): Promise<SaveRes> {
    return request.post(`/business/admin/station/save`, params);
}

/**
 * queryList 查询所有城市站点
 * @returns 返回所有站点名
 */
export function queryList(): Promise<QueryListRes> {
    return request.get(`/business/admin/station/quest-all`);
}